#include "WindowService.h"
#include <iostream>

int __cdecl wmain(int argc, TCHAR *argv[])
{
    if (lstrcmpi(argv[1], TEXT("install")) == 0) {
        SvcInstall();
        return -1;
    }
    if (lstrcmpi(argv[1], TEXT("uninstall")) == 0) {
        DeletePreService();
        return -1;
    }

    // TODO: Add any additional services for the process to this table.
    SERVICE_TABLE_ENTRY DispatchTable[] = {
        { SVCNAME, (LPSERVICE_MAIN_FUNCTION)SvcMain },
        { NULL, NULL }
    };

    // This call returns when the service has stopped.
    // The process should simply terminate when the call returns.

    if (!StartServiceCtrlDispatcher(DispatchTable)) {
        std::cout << GetLastError();
        SvcReportEvent((LPTSTR)TEXT("StartServiceCtrlDispatcher"));
    }
    return 0;
}
